package team.pwy.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

@Repository
public interface MemberMapper {
        // 续费会员
        @Update("update pwy.pwy_member set expiration_time = DATE_ADD(expiration_time,interval 30 day)  where user_id = #{val ue}")
        Integer updateByUserId(Integer userId);
        // 开通会员
        @Insert("insert into pwy.pwy_member (name, user_id,  open_time, expiration_time, status)values ('vip',#{value},now(),date_add(now(),interval 30 DAY ),1)")
        Integer addByUserId(Integer userId);
        // 重新开通会员
        @Update("update pwy.pwy_member set open_time = now(),expiration_time = date_add(now(),interval 30 DAY ),status = 1 where user_id = #{value}")
        Integer updateStatus(Integer userId);
}
